<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" onclick="on()" value="按钮一">  <br>
<input type="button" id="btn" value="按钮二">

<script>
  function on() {
    alert("按钮一被点了。。。")
  }
  document.getElementById("btn").onclick = function () {
    alert("按钮二被点了。。。")
  };
</script>
</body>
</html>